package bjtuoj;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * ClassName: Homework_1_G
 * Description:
 * date: 2021-09-25 22:16
 *
 * @author liyifan
 */
public class Homework_1_G {

    public static int n;

    public static int a[];

    public static int v[] = new int[20];

    public static long ans;

    public  static ArrayList<Integer> res = new ArrayList<>();

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        a = new int[n];
        for (int i = 0;i < n;i++) {
            a[i] = Integer.parseInt(scanner.next());
        }
        scanner.close();
        dfs(0);
        System.out.print(ans);
    }

    public static void dfs(int x) {
        if (x == n){
            long sum = 0;
            for(int i = 0;i < res.size() - 1;i ++){
                sum += res.get(i) ^ res.get(i + 1);
            }
            ans = Math.max(ans, sum);
            return;
        }
        for (int i = 0;i < n;i++){
            if (v[i] == 1)
                continue;
            v[i] = 1;
            res.add(a[i]);
            dfs(x + 1);
            v[i] = 0;
            res.remove(res.size() - 1);
        }
    }
}
